package com.curso.sesion10;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class SerializeDemo {
   public static void main(String [] args) {
      Employee e = new Employee();
      e.name = "Cesar Mateus";
      e.address = "car 4e #39-91 ph358";
      e.SSN = 80051690;
      e.number = 1;
      FileOutputStream fileOut = null;
      ObjectOutputStream out = null;
      try {
         fileOut = new FileOutputStream("E:\\Cesar\\CursoJava\\employee.ser");
         out = new ObjectOutputStream(fileOut);
         out.writeObject(e);
      } catch(IOException i) {
          i.printStackTrace();
      } finally {
    	  try {
    		  if (out != null) {
    			  out.flush();
    			  out.close();    			  
    		  }
    		  if (fileOut != null) {
    			  fileOut.close(); 
    		  }
    	  } catch (IOException e1) {
    		  e1.printStackTrace();
    	  }
      }
   }
}